package com.gscitysfy.cus.drain.modules.duty.controller;

import com.gscitysfy.cloudfrmwk.assistant.domain.Result;

import com.gscitysfy.cus.drain.modules.duty.entity.MoperDutyMnRule;
import com.gscitysfy.cus.drain.modules.duty.service.IMoperDutyMnRuleService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 排班规则设置接口
 * @author 刘少华
 * @version 1.0
 * @date  2022/3/28 15:57
 */

@RestController
@RequestMapping("/duty")
public class MoperDutyMnRuleController {

    @Autowired
    private IMoperDutyMnRuleService dutyRuleService;

    /**
     * 保存排班规则接口
     * @param listRule 排班规则实体集合
     * @return 统一返回消息
     */
    @PostMapping ("/saveRule")
    @Operation(summary = "排班规则保存",description = "根据实体类参数保存排班规则")
    public Result saveDutyRule(@RequestBody List<MoperDutyMnRule> listRule){
        return Result.content(dutyRuleService.saveDutyRule(listRule));
    }

    /**
     * 查询当前生效的排班规则
     * @return 统一返回消息
     */
    @GetMapping("/getRule")
    @Operation(summary = "获取当前排班规则",description = "获取当前生效的排班规则")
    public Result getDutyRule(){
        return Result.content(dutyRuleService.getDutyRule());
    }
}
